package mysql.work01;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class WorkTest {
    public static void main(String[] args) {
        Properties properties = new Properties();
        FileInputStream fileInputStream=null;
        try {
            fileInputStream = new FileInputStream("dbconn.properties");
            properties.load(fileInputStream);//将文件的内容读取到properties对象
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            if (fileInputStream!=null) {
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        System.out.println(properties);
    }
}
